﻿using Dapper;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;

namespace NETCORE.Dapper.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class BookController : ControllerBase
    {
        private readonly IDbConnection DB;

        public BookController(IDbConnection _db)
        {
            DB = _db;
        }

        [Route("GetBookAsync")]
        [HttpGet]
        public async Task<object> GetBookAsync()
        {
            var res= await DB.QueryAsync<object>("select * from te_book where id='0007e11c-f67e-4797-9b5e-d81cd1b0b081'");

            return res;
        }
    }
}
